package com.atom.swipebacklib;


import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.ViewGroup;

/**
 * ============================================================
 * project: MySwipBackLayout
 * package: com.atom.swipbacklib
 * fileDescribe:
 * user: admin
 * email: 1299854942@qq.com
 * createTime: 2017/7/27  11:18
 * modify:
 * version:: V1.0
 * ============================================================
 **/
public class SwipeLayoutParams extends ViewGroup.MarginLayoutParams {
    private static final int[] ATTRS = new int[]{
            android.R.attr.layout_weight
    };

    /**
     * The weighted proportion of how much of the leftover space
     * this child should consume after measurement.
     */
    public float weight = 0;

    /**
     * True if this pane is the slideable pane in the layout.
     */
    public  boolean slideable;

    /**
     * True if this view should be drawn dimmed
     * when it's been offset from its default position.
     */
    public boolean dimWhenOffset;

    public Paint dimPaint;

    public SwipeLayoutParams() {
        super(MATCH_PARENT, MATCH_PARENT);
    }

    public SwipeLayoutParams(int width, int height) {
        super(width, height);
    }

    public SwipeLayoutParams(ViewGroup.LayoutParams source) {
        super(source);
    }

    public SwipeLayoutParams(ViewGroup.MarginLayoutParams source) {
        super(source);
    }

    public SwipeLayoutParams(SwipeLayoutParams source) {
        super(source);
        this.weight = source.weight;
    }

    public SwipeLayoutParams(Context c, AttributeSet attrs) {
        super(c, attrs);

        final TypedArray a = c.obtainStyledAttributes(attrs, ATTRS);
        this.weight = a.getFloat(0, 0);
        a.recycle();
    }

}
